//
//  InheritViewController.swift
//  SwiftTest
//
//  Created by midea on 16/3/15.
//  Copyright © 2016年 Vincent. All rights reserved.
//

import Foundation

class Vehicle {
    var passengers : Int
    var weight : Float
    var driver : String
    
    func description() -> String {
        return "This vehicle takes " + String(passengers) + " passengers and weight is " + String(weight)
    }
    
    final func broken(){
        print("Vehicle was broken")
    }
    
    init(){
        passengers = 5
        weight = 1.5
        driver = "Tom"
    }
}

class Bus : Vehicle {
    override init() {
        super.init()
        passengers = 10
    }
    
    override func description() -> String {
        return "The bus takes " + String(passengers) + " passengers and weight is " + String(weight)
    }
}

class InheritViewController : BaseViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let vehicle = Vehicle()
        let bus = Bus()
        
        print(vehicle.description())
        print(bus.description())
        
        vehicle.broken()
        bus.broken()
    }
}